package com.siberiadante.multiscrolldemo.view;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * -------------------------------------------
 *
 * @author Alex-Zhang
 * @program MultiScrollDemo
 * @date 2019-02-19
 * -------------------------------------------
 */
public class MeRecyclerView extends RecyclerView {
    private boolean isStop;

    public MeRecyclerView(Context context) {
        super(context);
    }

    public MeRecyclerView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public MeRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (isStop) {
            return true;
        } else
            return super.dispatchTouchEvent(ev);
    }

    public void isIntercept(boolean isStop) {
        this.isStop = isStop;
    }
}
